<?php

class Application_Form_Speciality extends Validation_Form
{

  public function init()
  {
  	/*
  	 * data to form
  	 */
  	$majorDao = new Application_Model_Dao_Major();
  	$majors = $majorDao->getToSelect(); 
  	
  	/*
  	 * form
  	 */
    $this->setName("zendForm");
    $this->setMethod('post');
	$id = new Zend_Form_Element_Hidden('id');
	$id->addFilter('Int');
	$typeForm = $this->createElement('hidden','typeForm');
    $major = new Zend_Form_Element_Select('major_id');
   	$major->setLabel('Kierunek')
   	    		   ->setMultiOptions($majors)
   	    		   ->setRequired(true)
   	    		   ->addValidator('NotEmpty', true);
    
   	$speciality = $this->createElement('text', 'designation');
	$speciality->setLabel('Specjalność')
		->setRequired(TRUE)
		->setAttrib('size', 30)
		->addFilters(array(
		new Zend_Filter_StringTrim(),
		new Zend_Filter_StripNewlines(),
		new Zend_Filter_StripTags()
		))
		->addValidators(array(
		new Zend_Validate_NotEmpty(),
		new Zend_Validate_StringLength(array('min' => 5, 'max' => 30)),
		//new Zend_Validate_Alpha()
		));
   	$submit = new Zend_Form_Element_Submit('submit');
	$submit->setAttrib('id', 'submit');
    
    $this->addElements(array(
    	$id,
    	$major,
    	$speciality,
    	$typeForm,
        $submit,
        ));
  }


}

	